import React from 'react';
import ReactDOM from 'react-dom';
import {actions, connect, Link} from 'mirrorx';
import { Result, Icon, WhiteSpace } from 'antd-mobile';

import { FormattedMessage} from 'react-intl';

class App extends React.Component { 
	constructor(props) {
		super(props);
		this.state = {
			time:5
		}
	}

	componentDidMount(){		
		var count = 5
		timer  = setInterval(() =>{
			count --;
			this.setState({
				time: count
			})
		if(count == 0){
			actions.routing.push({
				pathname:'bill-info',
			})  
			clearInterval(timer)
		}
		},1000)
    }

	
   
	
	render() {
		return (<div className="bill-paySuccess">
			 	<WhiteSpace />				
				<Result
					img={<Icon type="check-circle" className="spe" style={{ fill: '#1F90E6',width:'44px',height:'44px' }} />}
					title={window.LangMessage.pay_success || "支付成功"}								
				/>
				<p><FormattedMessage id='back' defaultMessage='返回'/><Link to="bill-info" className="diy_color"><FormattedMessage id='my_bill' defaultMessage='我的账单'/></Link></p>
				<p>（{this.state.time}s<FormattedMessage id='auto_back' defaultMessage='后自动返回）'/></p>
				<WhiteSpace />
	  	</div>)
	}
}

export default App;